package com.duoduo.springboot.security.vo;

import org.springframework.beans.BeanUtils;

import com.duoduo.springboot.security.model.User;

/**
 * 用户VO
 * @author cgs1999@126.com
 * @date 2018年5月6日 下午8:49:18
 * @version 1.0.0
 */
public class UserVO extends BaseVO<Integer> {

	private static final long serialVersionUID = 873078534457520826L;
	private String account;
	private String password;

	public UserVO() {

	}

	public UserVO(Integer id, String account, String password) {
		setId(id);
		this.account = account;
		this.password = password;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * Entity转VO
	 * @param entity
	 * @return
	 */
	public static UserVO fromEntity(User entity) {
		UserVO vo = new UserVO();
		BeanUtils.copyProperties(entity, vo);
		return vo;
	}

	/**
	 * VO转Entity
	 * @param vo
	 * @return
	 */
	public static User fromEntity(UserVO vo) {
		User entity = new User();
		BeanUtils.copyProperties(vo, entity);
		return entity;
	}

}
